<?php
	global $_W,$_GPC;
	if($_W['role']){
		$pindex = max(1, intval($_GPC['page']));	
		$psize = 10;
		$sql = "SELECT * FROM ".tablename('mii_ang_timetemplate')." WHERE uniacid=:uniacid ORDER BY tid DESC LIMIT ".($pindex-1)*$psize.','.$psize;
		$template = pdo_fetchall($sql,array(':uniacid'=>$_W['uniacid']));
		$countSql = "SELECT COUNT(*)FROM " . tablename('mii_ang_timetemplate')."WHERE uniacid=:uniacid";
		$total = pdo_fetchcolumn($countSql,array(':uniacid'=>$_W['uniacid']));
		$pager = pagination($total, $pindex, $psize,$url='',$context = array('before' =>1, 'after' => 1, 'ajaxcallback' => '', 'callbackfuncname' => ''));	
		include $this->template('web/timetemplate/list');
	}else{
		message('没有操作权限');
	}

	function date_cn($json=''){
		$week =array('星期日','星期一','星期二','星期三','星期四','星期五','星期六');
		if($json){
			$arr = json_decode($json,true);
			$count = count($arr);
			foreach ($arr as $key => $v) {
				$weekArr[] = $week[$v];
			}
			$weekArr = implode('||', $weekArr);
			return $weekArr;
		}else{
			return '假日为空';
		}
	}

?>